
import { Column, HasMany, Table } from 'sequelize-typescript';
import { BaseModel } from '@/model'
import { DataTypes } from "sequelize";
import { SlidePic } from './slidePic.model';

@Table
export class Slide extends BaseModel {
  @Column({ type: DataTypes.STRING, allowNull: false, comment: "编码" })
  code: string;

  @Column({ type: DataTypes.STRING, allowNull: false, comment: '名称' })
  name: string;

  @Column({ type: DataTypes.INTEGER, allowNull: false, comment: "数量" })
  number: number;

  @Column({ type: DataTypes.INTEGER, defaultValue: 0, allowNull: false, comment: "状态" })
  status: number;

  @Column({ type: DataTypes.STRING, allowNull: false, comment: "更新人" })
  updateBy: string;

  @HasMany(() => SlidePic, {
    foreignKey: 'slideId',
    as: 'sysSlideShowPicList',
    onDelete: 'CASCADE'
  })
  sysSlideShowPicList: SlidePic[];
}

